<?php plogger_get_header(); ?>

<div class="thumbnail_container_index">
    <div id="cubeshow">
        <ul id="cubepics">
            <?php
	//newest e 刊分类
	$ids =array();
	//$sql = "SELECT DISTINCT parent_collection FROM `".PLOGGER_TABLE_PREFIX."pictures` ";
	$sql = 'select id from '.PLOGGER_TABLE_PREFIX.'collections where id in (
			SELECT DISTINCT parent_collection
	FROM '.PLOGGER_TABLE_PREFIX.'pictures) order by update_time DESC';
	
	$result = run_query($sql);
	while($row = mysql_fetch_assoc($result)) {
		$ids[] = $row['id'];
	}
			$i=0;
			foreach ($ids as $id){
			// init albums with collection id 
			check_collection_id($id);
			plogger_init_albums(array(
			'from' => 0,
			'limit' => 3,
			'collection_id' => $id,
			'sortby' => !empty($config['album_sortby']) ? $config['album_sortby'] : 'id',
			'sortdir' => !empty($config['album_sortdir']) ? $config['album_sortdir'] : 'DESC'
			));				
		if (plogger_has_albums()) : 
	    while(plogger_has_albums()) : 
			plogger_load_album();
			// Find thumbnail width/height
			$thumb_info = plogger_get_thumbnail_info();
			$thumb_width = $thumb_info['width']; // The width of the image. It is integer data type.
			$thumb_height = $thumb_info['height']; // The height of the image. It is an integer data type.
			?>
            <!-- list -->
            <li><a id=<?php echo "pic_".$i?> href="<?php echo plogger_get_album_url(); ?>" title="<?php echo plogger_get_album_name(); ?>" rel="<?php echo plogger_get_album_description(); ?>"><img src="<?php echo plogger_get_album_thumb(); ?>"/><span></span></a></li>
            <?php 
			$i++;
			if($i>8){
			break;
			}
			?>
            <?php endwhile; 
			endif;
			}
			?>
            <?php for(;$i<9;$i++){?>
            <li><a id="<?php echo "pic_".$i?>" href="#" title="暂无杂志" rel="暂无杂志描述"><img src="http://www.future.org.cn/ebook/plog-content/thumbs/uploads/import-67-Water-lilies.jpg"/><span></span></a></li>
            <?php }?>
        </ul>
        <div id="picsdes">
            <h2>最新杂志标题</h2>
            <p>该杂志的描述</p>
            <a href="#">查看完整杂志</a> </div>
        <div id="widget">
            <div id="search-container"> <?php echo generate_search_box(); ?>
                <div class="clearfix"></div>
            </div>
            <!-- /search-container -->
            <div id="publicinfo">
                <h3>公告</h3>
                <p>什么是未来 e 刊呢，大家来说说吧， e 刊的孩子快出文字啦</p>
            </div>
        </div>
    </div>
    <div class="clearfix"></div>
</div>
<script src="<?php echo THEME_URL ?>index.cube.js" type="text/javascript"></script>

<ul id="under_banner">
    <?php 
		$i =0;
		if (plogger_has_collections()) : 
		?>
    <?php while(plogger_has_collections()) : 
		plogger_load_collection();
		// Find thumbnail width/height
		$thumb_info = plogger_get_thumbnail_info();
		$thumb_width = $thumb_info['width']; // The width of the image. It is integer data type.
		$thumb_height = $thumb_info['height']; // The height of the image. It is an integer data type.
		echo $i ++ ? '<li class="seperate"></li>' : '';
		?>
    <li><a href="<?php echo plogger_get_collection_url(); ?> title="<?php echo plogger_get_collection_name(); ?>"><img src="<?php echo plogger_get_collection_thumb(); ?>"/><span><b><?php echo plogger_get_collection_name(); ?></b><br />
        <?php echo plogger_get_collection_description(); ?></span></a></li>
    <?php endwhile; ?>
    <li class="clearfix"></li>
    <?php endif;?>
</ul>
<!--the third pert-->
<?php plogger_get_footer(); ?>
